<?php

namespace app\wxoa\model\template;

class TemplateFactory
{
    public const TEST_TEMPID = 'testTemplate';
    public const SEND_BILL = 'billTemplate';
    public const TRAINING_REMINDER = 'trainingReminderTemple';
    public const SEND_GAME_APPLY_SUCCESS = 'gameApplySuccessTemplate';
    public const NEW_CONTEST_START = 'newContestStartTemplate';
    public const SCHOOL_APPLY_SUCCESS = 'schoolApplySuccessTemplate';
    public const SCHOOL_SUBMIT_WORK_END = 'schoolSubmitWorkEndTemplate';
    public const SCHOOL_VATE_START = 'schoolVateStartTemplate';
    public const SCHOOL_VATE_END_BEFORE = 'schoolVateEndBeforeTemplate';
    public const SCHOOL_VATE_END = 'schoolVateEndTemplate';
    public const PUBLISH_RESULT = 'publishResultTemplate';

    private $template;
    private $templateData;

    public function __construct($template, $templateData)
    {
        $this->template = $template;
        $this->templateData = $templateData;
    }

    public function getTemplate()
    {
        switch ($this->template) {
            case self::SEND_BILL:
                return new BillTemplate($this->templateData);
            case self::SEND_GAME_APPLY_SUCCESS:
                return new GameApplySuccessTemplate($this->templateData);
            case self::TRAINING_REMINDER:
                return new TrainingReminderTemplate($this->templateData);
            case self::TEST_TEMPID:
                return new TestTemplate($this->templateData);
            case self::NEW_CONTEST_START:
                return new NewContestStartTemplate($this->templateData);
            case self::SCHOOL_APPLY_SUCCESS:
                return new SchoolApplySuccessTemplate($this->templateData);
            case self::SCHOOL_SUBMIT_WORK_END:
                return new SchoolSubmitWorkEndTemplate($this->templateData);
            case self::SCHOOL_VATE_START:
                return new SchoolVateStartTemplate($this->templateData);
            case self::SCHOOL_VATE_END_BEFORE:
                return new SchoolVateEndBeforeTemplate($this->templateData);
            case self::SCHOOL_VATE_END:
                return new SchoolVateEndTemplate($this->templateData);
            case self::PUBLISH_RESULT:
                return new PublishResultTemplate($this->templateData);
            default:
                exception('unkonw Template type：' . $this->template);
                break;
        }
    }
}
